package ch06_抽象类接口与嵌套类;
interface Car{
	void start();
	void accelerate();
	void brake();
}
class Santana implements Car{
	public void start() {
		System.out.println("插入并转动钥匙，桑塔纳启动了……");
	}
	public void accelerate() {
		System.out.println("踩离合、挂挡、踩油门、松离合，桑塔纳开始加速……");
	}
	public void brake() {
		System.out.println("踩制动，桑塔纳开始减速……");
	}
}
class Tesla implements Car{
	public void start() {
		System.out.println("识别指纹信息，特斯拉启动了……");
	}
	public void accelerate() {
		System.out.println("踩下加速踏板，特斯拉开始加速……");
	}
	public void brake() {
		System.out.println("车载雷达识别到前方行人，特斯拉开始减速……");
	}
}
public class Driver {
	void drive(Car c) {
		c.start();
		c.accelerate();
		c.brake();
	}
	public static void main(String[] args) {
		Driver d =new Driver();
		Car c1=new Santana();
		Car c2 =new Tesla();
		d.drive(c1);
		System.out.println("----换辆车开----");
		d.drive(c2);
	}
}
